<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

<ui:define name="head">
    <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
    <script type="text/javascript" language="javascript">
        document.onkeydown = function TabReplace() {
            if (event.keyCode == 13) {
                if (event.srcElement.tagName != 'BUTTON')
                    event.keyCode = 9;
                else
                    event.srcElement.click();
            }
        }
        function actSelect(obj, pageName) {
            var pkid = obj;
            var sfeature = "dialogwidth:1300px;dialogheight:700px;center:yes;location:no;help:no;resizable:no;scroll:yes;status:no";
            var arg = new Object();
            arg.doType = "select";
            if (pageName == "Tk_Detail") {
                var rtn = dialog("../item/itemHieRelapQry_Tkctt.xhtml?strType=0&amp;strTkCttPkid=" + pkid + "", arg, sfeature);
            }
        }
    </script>
    <style type="text/css">
        .img {
            width: 20px;
            height: 30px;
        }
    </style>
</ui:define>
<ui:define name="content">
    <div style="margin:5px;">
        <h:form id="form" enctype="multipart/form-data">
            <p:growl id="msgs" showDetail="true"/>
            <p:focus for="powerType"/>
            <p:panel id="inputTk" header="权限信息查询" style="width: 100%">
                <h:panelGrid columns="2" style="width: 100%">
                    <h:panelGrid id="pgTkctt">
                        <h:panelGrid columns="6">
                            <h:outputLabel value="所属种类：" for="powerType" style="font-weight: bold"/>
                            <p:selectOneMenu id="powerType" value="#{esInitPowerHisAction.esInitPowerHis.powerType}"
                                             style="width:131px">
                                <f:selectItems value="#{esCommonAction.itemTypeList}"/>
                                <p:ajax update="msgs,pgTkctt"
                                        listener="#{esInitPowerHisAction.setEsInitPowerHisActionOfPowerPkidAction}"/>
                            </p:selectOneMenu>
                            <h:outputLabel id="strLabel1"
                                           value="#{esInitPowerHisAction.strLabel1}："
                                           for="tkcttCstpl" style="font-weight: bold"
                                           rendered="#{esInitPowerHisAction.strRendered1}"/>
                            <p:selectOneMenu id="tkcttCstpl"
                                             value="#{esInitPowerHisAction.strTkcttCstplSelected}"
                                             style="width:131px"
                                             rendered="#{esInitPowerHisAction.strRendered1}">
                                <f:selectItems value="#{esInitPowerHisAction.esInitCtt1List}"/>
                                <p:ajax update="msgs,pgTkctt"
                                        listener="#{esInitPowerHisAction.setFromTkAndCttToSStlAction}"/>
                            </p:selectOneMenu>
                            <h:outputLabel id="strLabel2"
                                           value="#{esInitPowerHisAction.strLabel2}："
                                           for="subcttStlTkcttMeaSta" style="font-weight: bold"
                                           rendered="#{esInitPowerHisAction.strRendered2}"/>
                            <p:selectOneMenu id="subcttStlTkcttMeaSta"
                                             value="#{esInitPowerHisAction.esInitPowerHis.powerPkid}"
                                             style="width:131px"
                                             rendered="#{esInitPowerHisAction.strRendered2}">
                                <f:selectItems value="#{esInitPowerHisAction.esInitCtt2List}"/>
                            </p:selectOneMenu>
                        </h:panelGrid>

                        <h:panelGrid columns="2">
                            <h:outputLabel value="期数编码：" for="pno" style="font-weight: bold"/>
                            <p:inputText id="pno" value="#{esInitPowerHisAction.esInitPowerHis.periodNo}"
                                         style="width:127px"/>
                        </h:panelGrid>
                        <h:panelGrid columns="4">
                            <h:outputLabel value="创建人名：" for="createid" style="font-weight: bold"/>
                            <p:inputText id="createid" value="#{esInitPowerHisAction.esInitPowerHis.createdBy}"
                                         style="width:127px"/>
                            <h:outputLabel value="修改人名：  " for="upid" style="font-weight: bold"/>
                            <p:inputText id="upid" value="#{esInitPowerHisAction.esInitPowerHis.lastUpdBy}"
                                         style="width:127px"/>
                        </h:panelGrid>

                        <h:panelGrid columns="4">
                            <h:outputLabel value="创建时间：" for="createdate" style="font-weight: bold"/>
                            <p:inputText id="createdate" value="#{esInitPowerHisAction.esInitPowerHis.createdDate}"
                                         onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                                         style="width:127px"/>

                            <h:outputLabel value="修改时间：" for="update" style="font-weight: bold"/>
                            <p:inputText id="update" value="#{esInitPowerHisAction.esInitPowerHis.lastUpdDate}"
                                         onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                                         style="width:127px"/>
                        </h:panelGrid>

                        <h:panelGrid columns="8">
                            <h:outputLabel value="状态标志：" for="sf" style="font-weight: bold"/>
                            <p:selectOneMenu id="sf" value="#{esInitPowerHisAction.esInitPowerHis.statusFlag}"
                                             style="width:131px">
                                <f:selectItems value="#{esCommonAction.statusFlagList}"/>
                            </p:selectOneMenu>
                            <h:outputLabel value="状态原因：" for="preStatusFlag" style="font-weight: bold"/>
                            <p:selectOneMenu id="preStatusFlag"
                                             value="#{esInitPowerHisAction.esInitPowerHis.preStatusFlag}"
                                             style="width:131px">
                                <f:selectItems value="#{esCommonAction.preStatusFlagList}"/>
                            </p:selectOneMenu>

                            <h:outputLabel value="结束标志：" for="endFlag" style="font-weight: bold"/>
                            <p:selectOneMenu id="endFlag" value="#{esInitPowerHisAction.esInitPowerHis.endFlag}"
                                             style="width:131px">
                                <f:selectItems value="#{esCommonAction.endFlagList}"/>
                            </p:selectOneMenu>
                            <h:outputLabel value="删除标志：" for="deletedFlag" style="font-weight: bold"/>
                            <p:selectOneMenu id="deletedFlag" value="#{esInitPowerHisAction.esInitPowerHis.deletedFlag}"
                                             style="width:131px">
                                <f:selectItems value="#{esCommonAction.deleteFlagList}"/>
                            </p:selectOneMenu>
                        </h:panelGrid>

                        <h:panelGrid columns="6">
                            <h:outputLabel value="操作类型：" for="sparef" style="font-weight: bold"/>
                            <p:inputTextarea id="sparef" value="#{esInitPowerHisAction.esInitPowerHis.spareField}"
                                             rows="1" autoResize="false" style="width:128px"/>
                        </h:panelGrid>
                    </h:panelGrid>
                    <h:panelGrid columns="1" style="width:10%">
                        <h:panelGrid columns="1">
                            <p:commandButton id="qryBtn" value="查询"
                                             action="#{esInitPowerHisAction.onQueryAction()}"
                                             style="width:90px"
                                             update="pdt,msgs">
                            </p:commandButton>
                            <p:commandButton id="resetBtn" value="重置"
                                             type="reset"
                                             style="width:90px"
                                             update="inputTk,msgs">
                            </p:commandButton>
                        </h:panelGrid>
                    </h:panelGrid>
                </h:panelGrid>
            </p:panel>

            <p:ajaxStatus style="width:16px;height:16px;">
                <f:facet name="start">
                    <h:graphicImage value="/images/ajaxloading.gif"/>
                </f:facet>
                <f:facet name="complete">
                    <h:outputText value=""/>
                </f:facet>
            </p:ajaxStatus>
            <!--列表维护-->
            <p:dataTable id="pdt" style="width:100%;"
                         value="#{esInitPowerHisAction.esInitPowerHisList}"
                         var="record"
                         rowKey="#{record.powerPkid}"
                         selectionMode="single"
                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         paginator="true"
                         paginatorPosition="bottom"
                         rows="15"
                         rowsPerPageTemplate="100,50,30,15,5"
                         emptyMessage="数据记录为空..."
                         widgetVar="DtInitTkcttList">

                <!--<p:ajax event="rowSelect" listener="#{esInitPowerHisAction.onRowSelect}" update=":form:inputTk"/>-->
                <p:ajax event="rowSelect" listener="#{esInitPowerHisAction.selectRecord()}" update=":form:inputTk"/>

                <p:column headerText="pkid" style="display:none;" rendered="false">
                    <h:outputText id="tetid" style="display:none;" rendered="false" value="#{record.powerPkid}"/>
                </p:column>

                <p:column headerText="对象所属" style="text-align:center">
                    <h:outputText value="#{esCommonAction.getLabelByValueInItemTypeList(record.powerType)}"/>
                </p:column>

                <p:column headerText="对象" style="text-align:left">
                    <h:outputText value="#{esInitCttAction.getEsInitCttByPkId(record.powerPkid).name}"/>
                </p:column>

                <p:column headerText="期数编码" style="text-align:center">
                    <h:outputText value="#{record.periodNo}"/>
                </p:column>

                <p:column headerText="状态标志" style="text-align:center">
                    <h:outputText value="#{esPowerAction.getLabelByValueInStatusFlaglist(record.statusFlag)}"/>
                </p:column>

                <p:column headerText="创建人" style="text-align:center">
                    <h:outputText value="#{esCommonAction.opersMap.get(record.createdBy)}"/>
                </p:column>

                <p:column headerText="创建时间" style="text-align:center">
                    <h:outputText value="#{record.createdDate}"/>
                </p:column>

                <p:column headerText="修改人" style="text-align:center">
                    <h:outputText value="#{esCommonAction.opersMap.get(record.lastUpdBy)}"/>
                </p:column>

                <p:column headerText="修改时间" style="text-align:center">
                    <h:outputText value="#{record.lastUpdDate}"/>
                </p:column>

                <p:column headerText="状态原因" style="text-align:center">
                    <h:outputText value="#{esPowerAction.getLabelByValueInPreStatusFlaglist(record.preStatusFlag)}"/>
                </p:column>

                <p:column headerText="删除标志" style="text-align:center">
                    <h:outputText value="#{esCommonAction.getLabelByValueInDeleteFlaglist(record.deletedFlag)}"/>
                </p:column>
                <p:column headerText="结束标志" style="text-align:center">
                    <h:outputText value="#{esPowerAction.getLabelByValueInEndFlagList(record.endFlag)}"/>
                </p:column>
                <p:column headerText="备注內容" style="text-align:center">
                    <h:outputText value="#{record.spareField}"/>
                </p:column>
            </p:dataTable>
        </h:form>
    </div>
</ui:define>
</ui:composition>